---
title: 'Database migrations'
description: 'How to create and run database migrations in the Saas UI starterkit'
---

Database migrations are a fundamental part of managing your database schema. They allow you to make changes to your database schema in a controlled and repeatable way.
In the Saas UI starterkit, we use the [Drizzle Kit](https://orm.drizzle.team/kit-docs/overview) CLI to manage database migrations.

## Migration files

[Migration files](https://orm.drizzle.team/kit-docs/overview#migration-files) are generated by Drizzle Kit and live in the `packages/db/drizzle` directory.

## Creating migrations

When you make changes to your database schema, you can generate a new migration file using the following command.

```bash
yarn db:generate
```

This will run the Drizzle Kit CLI and create a new migration file in the `packages/db/drizzle` directory.

## Running migrations

To apply migrations run the following command:

```bash
yarn db:migrate
```

## Prototyping database changes

If you want to iterate quickly during local development without having to create migrations you can directly push your schema changes to the database.

<Info>
  Don't use this command on your production database, unless your provider
  manages migrations for you, like Neon.
</Info>

```bash
yarn db:push
```

## Other commands

Drizzle Kit supports a range of other useful commands that can be run by calling the CLI directly.

See all commands in the [Drizzle Kit docs](https://orm.drizzle.team/kit-docs/commands).

```bash
# Drop migration
yarn workspace @acme/db drizzle-kit drop

# Check if migrations are consistent
yarn workspace @acme/db drizzle-kit check
```

## Learn more

- [Drizzle Kit](https://orm.drizzle.team/kit-docs/overview)
